﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PDKCardButton : MonoBehaviour {

    //public UISprite DragMoveStatus;
    EginPDK pdk = EginPDK.Instance;
    public UISprite DragMoveStatus;
    private bool isSelected;

    /// <summary>
    /// 是否被点击中
    /// </summary>
    public bool Select
    {
        set { isSelected = value; }
        get { return isSelected; }
    }
    private void Start()
    {
        isSelected = false;
    }


    public void ClickCardEvent()
    {

        if (isSelected)
        {
            transform.localPosition -= Vector3.up * 10;
            isSelected = false;
        }
        else
        {
            transform.localPosition += Vector3.up * 10;
            isSelected = true;
        }
    }

    public void PromptInit()
    {
        isSelected = true;
        transform.localPosition = new Vector3(transform.localPosition.x, 10, 0);
    }

    public bool CanMoveEnter = true;
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "PutCard")
        {
            //Debug.Log(other.name + ".OnTriggerEnter." + gameObject.name);
            DragMoveStatus.gameObject.SetActive(true);
        }

    }

    void OnTriggerExit(Collider other)
    {
        if (other.tag == "PutCard")
        {
            // Debug.Log(other.name + ".OnTriggerExit." + gameObject.name);
            DragMoveStatus.gameObject.SetActive(false);

        }
    }
}
